﻿@{
    ViewBag.Title = "店铺设置";
    ViewBag.NavTitle = "店铺设置";
    Layout = "~/Views/Shared/_UsersCenterLayout.cshtml";
}
@using MvcMall.Portal.Controllers.Stores.ViewModels;
@model StoreInfoDtoModel
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/fckeditor2.3.6/fckeditor.js")" type="text/javascript"></script>
<script type="text/javascript">
    function OpenFileBrowser(width, height) {
        // oEditor must be defined.
        var windowWidth = document.body.scrollWidth;
        var windowHeight = document.body.scrollHeight;
        var iLeft = (windowWidth - width) / 2;
        var iTop = (windowHeight - height) / 2;

        var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes";
        sOptions += ",width=" + width;
        sOptions += ",height=" + height;
        sOptions += ",left=" + iLeft;
        sOptions += ",top=" + iTop;

        window.open("/FckEditor/browser?Type=Image", 'FCKBrowseWindow', sOptions);
    }

    function SetUrl(url) {
        var img = document.getElementById('storeLogo');
        img.src = url;

        var imgInput = document.getElementById('StoreImage');
        imgInput.value = url;
    }
</script>
@using MvcFckEditor.Views.FckEditor;
<div class="right_box">
    <div class="right_box_map">
        店铺设置
    </div>
    @using (Html.BeginForm())
    {
        <table style="margin-top: 10px;" width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr height="40">
                <td class="tab2_td">
                    @Html.HiddenFor(c => c.StoreId)
                    @Html.LabelFor(c => c.StoreGrade)：
                </td>
                <td>
                    @Html.DropDownListFor(c => c.StoreGrade, ViewData["StoreGradeList"] as IEnumerable<SelectListItem>, new { @disabled = "disabled" })
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.StoreGrade)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.StoreCat)：
                </td>
                <td>
                    @Html.DropDownListFor(c => c.StoreCat, ViewData["StoreCatList"] as IEnumerable<SelectListItem>, new { @disabled = "disabled" })
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.StoreCat)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.StoreType)：
                </td>
                <td>
                    @Html.DropDownListFor(c => c.StoreType, ViewData["StoreTypeList"] as IEnumerable<SelectListItem>, new { @disabled = "disabled" })
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.StoreType)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.OwnerName)：
                </td>
                <td>
                    @Html.TextBoxFor(c => c.OwnerName, new { @class = "tab_input", @readonly = "true" })
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.OwnerName)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.IdentityCardId)：
                </td>
                <td>
                    @Html.TextBoxFor(c => c.IdentityCardId, new { @class = "tab_input", @readonly = "true" })
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.IdentityCardId)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.IdentityCardImage)：
                </td>
                <td>
                    <a style=" color:Red; cursor:pointer" target="_blank" href="@Model.IdentityCardImage">@Html.LabelFor(c => c.IdentityCardImage)</a>
                    @Html.HiddenFor(c => c.IdentityCardImage)
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.IdentityCardImage)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.LicenseImage)：
                </td>
                <td>
                    <a style=" color:Red; cursor:pointer" target=_blank href="@Model.LicenseImage">@Html.LabelFor(c => c.LicenseImage)</a>
                    @Html.HiddenFor(c => c.LicenseImage)
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.LicenseImage)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.StoreName)：
                </td>
                <td>
                    @Html.TextBoxFor(c => c.StoreName, new { @class = "tab_input" })
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.StoreName)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.StoreImage)：
                </td>
                <td>
                    @Html.HiddenFor(c => c.StoreImage)
                    <img id="storeLogo" src="@(string.IsNullOrEmpty(Model.StoreImage) ? "/Content/images/noimage.png" : Model.StoreImage)" style="width: 90px; height: 90px;" />
                    <br />
                    <input type="button" value="浏览我的空间" onclick="OpenFileBrowser(800,500)" />
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.StoreImage)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.StoreIntro)：
                </td>
                <td>
                    @Html.TextArea("StoreIntro", Model.StoreIntro, new { name = "StoreIntro" })
                </td>
                <td>
                </td>
            </tr>
            <tr height="40">
                <td>
                </td>
                <td>
                </td>
                <td>@Html.ValidationMessageFor(c => c.StoreIntro)
                </td>
            </tr>
            <tr height="40">
                <td class="tab2_td">
                    @Html.LabelFor(c => c.StoreDesc)：
                </td>
                <td>
                    @Html.TextArea("StoreDesc", Model.StoreDesc, new { name = "StoreDesc" })
                </td>
                <td>
                </td>
            </tr>
            <tr height="40">
                <td>
                </td>
                <td>
                </td>
                <td>
                    @Html.ValidationMessageFor(c => c.StoreDesc)
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td colspan="2">
                    <input type="submit" value="保存设置" />
                </td>
            </tr>
        </table>
    }
    <script type="text/javascript">
        window.onload = function () {
            var sBasePath = '@Url.Content("~/fckeditor2.3.6/")';
            var oFCKeditor = new FCKeditor('StoreIntro');
            oFCKeditor.BasePath = sBasePath;
            oFCKeditor.Height = '400px';
            oFCKeditor.ReplaceTextarea();

            var editor2 = new FCKeditor('StoreDesc');
            editor2.BasePath = sBasePath;
            editor2.Height = '400px';
            editor2.ReplaceTextarea();
        }
    </script>
</div>
